package thread;

public class SleepDemo2 {
    public static void main(String[] args) {
        Thread gjl = new Thread("郭金磊"){
            public void  run(){
                try{
                    System.out.println(getName()+"正在休息");
                    Thread.sleep(10000);
                } catch (InterruptedException e) {
                    System.out.println(getName()+"被打断");
                }
                System.out.println(getName()+"休息完毕");
            }
        };

        Thread chn = new Thread("陈浩楠"){
            public void run(){
                try {
                    System.out.println(getName()+"思考去哪吃饭");
                    Thread.sleep(3000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(getName()+"问问郭金磊吧");
                gjl.interrupt();
            }
        };
        gjl.start();
        chn.start();
    }
}
